package com.zhouyu.service;


import com.zhouyu.spring.Autowired;
import com.zhouyu.spring.BeanNameAware;
import com.zhouyu.spring.Component;
import com.zhouyu.spring.InitializingBean;
import com.zhouyu.spring.Scope;

/**
 * @Description 用户服务类
 * @Author dangxianyue
 * @Date 2024/3/26 10:12
 */
// @Component("userService")
@Component // 不指定beanName，Spring会自动生成
@Scope(Scope.SINGLETON)
public class UserService implements UserInterface, BeanNameAware, InitializingBean {

    @Autowired
    private OrderService orderService;

    private String beanName;


    @Override
    public void test() {
        System.out.println(orderService);
        System.out.println(beanName);
    }

    @Override
    public void setBeanName(final String beanName) {
        this.beanName = beanName;
    }

    @Override
    public void afterPropertiesSet() {
        System.out.println("自定义初始化逻辑...");
    }
}
